package com.test;

public class Equation {
	public float a;
	public float b;
	public float c;
	public double[] d;

	public Equation(float a, float b, float c) {
		this.a = a;
		this.b = b;
		this.c = c;
		this.d = new double[2];
	}

	boolean getRealRoot() {
		float temp = b * b - 4 * a * c;
		if (temp < 0)
			return false;
		else {
			this.d[0] = (-b + Math.sqrt(temp)) / (2 * a);
			this.d[1] = (-b - Math.sqrt(temp)) / (2 * a);
			return true;
		}
	}

	public static void main(String[] arg) {
		Equation e1 = new Equation(1, 2, 1);
		if (e1.getRealRoot()) {
			System.out.print(e1.d[0]);
			System.out.print(";");
			System.out.println(e1.d[1]);
		} else {
			System.out.print("no real root");
		}
	}

}